package com.ybkj.o2o.mc.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ybkj.o2o.mc.entity.PassengerManage;
import com.ybkj.o2o.mc.mapper.PassengerManagerMapper;
import com.ybkj.o2o.mc.service.PassengerManagerService;

@Service
public class DefaultPassengerManagerService implements PassengerManagerService{

	@Autowired
	private PassengerManagerMapper passengerManagerMapper;
	
	@Override
	public int insert(PassengerManage passengerManage) {

		if (null == passengerManage.getCreated()) {
			passengerManage.setCreated(new Date());
	    }
	    if (null == passengerManage.getUpdated()) {
	    	passengerManage.setUpdated(new Date());
	    }
		
		return passengerManagerMapper.insert(passengerManage);
	}

	@Override
	public PassengerManage findPassengerManagerByParam(
			PassengerManage passengerManage) {
		
		return passengerManagerMapper.findPassengerManagerByParam(passengerManage);
	}

	@Override
	public int update(PassengerManage passengerManage) {
		if (null == passengerManage.getUpdated()) {
	    	passengerManage.setUpdated(new Date());
	    }
		
		return passengerManagerMapper.update(passengerManage);
	}

	@Override
	public int deleteByParam(PassengerManage passengerManage) {
		return passengerManagerMapper.deleteByParam(passengerManage);
	}

}
